package com.haifeng.im.service;

import com.haifeng.im.mapper.AdminDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    AdminDao dao;

    @Override
    public List<Map> findbyadmin(String admin, String password) {

        if (!admin.isEmpty() && !password.isEmpty()) {
            return dao.login(admin, password);
        }
        return new ArrayList<>();
    }

    @Override
    public void updatetoken(String admin, String token) {
        if (!admin.isEmpty()&&!token.isEmpty()) {
            dao.updatetoken(admin, token);
        }
    }
}
